package com.example.kotlin.basis

/**
 * Created by xiao_tan on 17/7/23.
 * 函数用法
 */

fun main(args: Array<String>) {

    var a = 10
    var b = 5;
    println("a+b=" + com.example.kotlin.basis.plus(a, b))
    println("a-b=" + com.example.kotlin.basis.minus(a, b))
    println("a*b=" + com.example.kotlin.basis.multi(a, b))
    println("a/b=" + com.example.kotlin.basis.divide(a, b))

    println(com.example.kotlin.basis.sayHello("zgl"))
    println(com.example.kotlin.basis.checkAge(27))
    com.example.kotlin.basis.saveLog(8)
}

fun plus(a: Int, b: Int): Int {
    return a + b
}

fun minus(a: Int, b: Int): Int {
    return a - b
}

fun multi(a: Int, b: Int): Int {
    return a * b
}

fun divide(a: Int, b: Int): Int {
    if (b == 0)
        return 0
    return a / b
}

fun sayHello(name:String):String{
    return "name: " + name
}

fun checkAge(age: Int):Boolean{
    return age >= 18;
}

fun saveLog(logLevel: Int){
    println("logLevel: " + logLevel)
}

